<template>
   
        <van-swipe class="my-swipe" :autoplay="1000" indicator-color="white">
        <van-swipe-item m v-for="item in bannerList">
          <img :src="item.img" alt="">
        </van-swipe-item>
      </van-swipe>
   
</template>

<script setup lang="ts">
import { bannerListAPI } from "@/api/goods";
import { reactive } from "vue";
import type { IBanner } from "@/utils/type";


// 定义数组，用于存放获取到的轮播图数据列表
let bannerList: Array<IBanner> = reactive([]);
bannerListAPI().then((res: any) => {
//   console.log(res.data.data);
 
  bannerList.splice(0, bannerList.length, ...res.data.data);
});
</script>

<style scoped>
    .my-swipe .van-swipe-item {
      color: #fff;
      font-size: 20px;
      line-height: 150px;
      height: 150px;
      text-align: center;
    }
</style>